<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="../include/tag.jsp"%>
<html>
<head>
    <title>Title</title>
    <%@include file="../include/commonFile.jsp"%>
</head>
<body style="min-width: 1050px">
    <input  id="projectId" name="projectId" value="${projectId}" hidden>
    <input  id="targetId" name="targetId" value="${targetId}" hidden>
    <div class="chart-content" id="charts" style="height:399px"></div>
    <script type="text/javascript" src="${ctx}/static/echarts-3.0/echarts.min.js"></script>
    <script type="text/javascript" src="${ctx}/static/echarts-3.0/base_config.js"></script>
    <script type="text/javascript">
        var projectId = $('#projectId').val();
        var targetId = $('#targetId').val();
        $.get('${ctx}/crowdfund/support/chart.do',{projectId:projectId},function (res) {
            console.log(res);
            var chart = echarts.init(document.getElementById('charts'));
            var option = {
                title : {
                    text:'近一月支持趋势图'
                },
                xAxis: {
                    data: res.data.dateList
                },
                series: [{
                    name: '支持金额',
                    type: 'line',
                    data: res.data.paymentList,
                }
                ]
            };
            option = getEchartBaseLineOpt(option);
            chart.setOption(option);

            chart.on('click', function (params) {
                var createDate = params.name;
                var date = new Date(createDate);
                if (date.toString() == 'Invalid Date'){
                    return;
                }
                parent.location.href = "${ctx}/crowdfund/support/listForProjectId.do?id="+targetId+"&projectId="+projectId+"&startTime="+createDate;
            });
        });


    </script>
</body>
</html>
